﻿<UserControl x:Class="Silverlightaroo.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="900" Height="500"
    xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="28"></RowDefinition>
            <RowDefinition Height="28"></RowDefinition>
            <RowDefinition Height="28"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="280"></ColumnDefinition>
            <ColumnDefinition Width="240"></ColumnDefinition>
            <ColumnDefinition Width="*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" 
             Padding="6">
            <Run Foreground="Orange">Silverlight-aroo (Searcharoo + JSON)</Run>
            <Run Foreground="Blue">with Silverlight Map Control</Run>
            <Run Foreground="Gray">(CTP)</Run>
        </TextBlock>
        <TextBox Grid.Column="0" Grid.Row="1" x:Name="query" Text="manhattan" />
        <Button Grid.Column="1" Grid.Row="1" Content="Search" Click="Search_Click" />
        <StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal">
            <RadioButton x:Name="searchAllRadio" GroupName="searchTypeGroup" Content="All" Margin="10 3 0 0" IsChecked="true" Click="searchRadio_Click"></RadioButton>
            <RadioButton x:Name="searchWebRadio" GroupName="searchTypeGroup" Content="Webpages only" Margin="20 3 0 0" Click="searchRadio_Click"></RadioButton>
            <RadioButton x:Name="searchImageRadio" GroupName="searchTypeGroup" Content="Images only" Margin="20 3 0 0" Click="searchRadio_Click"></RadioButton>
        </StackPanel>
        
        <ListBox Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" 
                 x:Name="resultList" 
                 Width="510">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Vertical" Width="500"
                                ><HyperlinkButton TargetName="_blank" 
                            NavigateUri="{Binding Path=url}" 
                            Content="{Binding Path=name}" Foreground="Blue" />
                        <TextBlock Text="{Binding description}" TextWrapping="Wrap" />
                        <TextBlock Text="{Binding tags}" Foreground="DarkMagenta" TextWrapping="Wrap" />
                        <TextBlock Text="{Binding summary}" Foreground="Green" FontSize="10" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <Grid x:Name="Spinner" Grid.Column="0" Grid.Row="3" Visibility="Collapsed">
            <Grid.RenderTransform>
                <ScaleTransform x:Name="SpinnerScale" ScaleX="0.5" ScaleY="0.5" />
            </Grid.RenderTransform>
            <Canvas RenderTransformOrigin="0.5,0.5" Width="120" Height="120">
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="20.1696" Canvas.Top="9.76358" 
            Stretch="Fill" Fill="#E6FCBE54"/>
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="2.86816" Canvas.Top="29.9581" 
            Stretch="Fill" Fill="#CDFCBE54"/>
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="5.03758e-006" Canvas.Top="57.9341" 
            Stretch="Fill" Fill="#B3FCBE54"/>
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="12.1203" Canvas.Top="83.3163" 
            Stretch="Fill" Fill="#9AFCBE54"/>
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="36.5459" Canvas.Top="98.138" 
            Stretch="Fill" Fill="#80FCBE54"/>
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="64.6723" Canvas.Top="96.8411" 
            Stretch="Fill" Fill="#67FCBE54"/>
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="87.6176" Canvas.Top="81.2783" 
            Stretch="Fill" Fill="#4DFCBE54"/>
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="98.165" Canvas.Top="54.414" 
            Stretch="Fill" Fill="#34FCBE54"/>
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="92.9838" Canvas.Top="26.9938" 
            Stretch="Fill" Fill="#1AFCBE54"/>
                <Ellipse Width="21.835" Height="21.862" Canvas.Left="47.2783" Canvas.Top="0.5" 
            Stretch="Fill" Fill="#FFFCBE54"/>
                <Canvas.RenderTransform>
                    <RotateTransform x:Name="SpinnerRotate" Angle="0" />
                </Canvas.RenderTransform>
                <Canvas.Triggers>
                    <EventTrigger RoutedEvent="ContentControl.Loaded">
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="SpinnerRotate" 
                                 Storyboard.TargetProperty="(RotateTransform.Angle)" 
                                 From="0" To="360" Duration="0:0:01" 
                                 RepeatBehavior="Forever" />
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger>
                </Canvas.Triggers>
            </Canvas>
        </Grid>

        <m:Map x:Name="ResultMap"
               Margin="10 10 10 10"
               Grid.Row="0" Grid.RowSpan="4" 
               Grid.Column="2" 
               Visibility="Collapsed">
        </m:Map>
    </Grid>
</UserControl>
